
package org.wangnian.demo02_config_file.config;

import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;
import org.wangnian.demo02_config_file.model.UserEntity;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Component
// 参数配置的数据类型是一个对象或者数组，这个时候才用 @ConfigurationProperties 会是一个比较好的选择！
// 注意，必须实现 set 方法
@ConfigurationProperties(prefix = "config4")
public class Config4 {

    private List<UserEntity> userList = new ArrayList<>();

    public List<UserEntity> getUserList() {
        return userList;
    }

    public void setUserList(List<UserEntity> userList) {
        this.userList = userList;
    }

    @Override
    public String toString() {
        return "Config4{" +
                "userList=" + userList +
                '}';
    }
}
